<?php

// +----------------------------------------------------------------------
// | image 模型
// +----------------------------------------------------------------------
// | @author fancsen
// +----------------------------------------------------------------------

namespace app\api\model;

use app\api\model\BaseModel;

class Image extends BaseModel 
{
    // 设置当前模型对应的完整数据表名称
    protected $table = 'image';
    //自动时间戳
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    //protected $createTime = 'create_at';
    protected $updateTime = 'update_time';
    protected $deleteTime = 'delete_time';
    //隐藏字段
    protected $hidden = ['id','from','delete_time','update_time'];

    public function img()
	{
		return $this->belongsTo('image','img_id','id');
    }	
    
    public function getUrlAttr($value,$data)
    {
        return $this->prefixImgUrl($value,$data);
    }
}